package com.example.inventoryservice.demo.inventory;

import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Service;
@Service
@RocketMQMessageListener(topic = "ORDER_CREATED", consumerGroup = "inventory-consumer-group")
public class InventoryConsumer implements RocketMQListener<String> {
    @Override
    public void onMessage(String orderId) {
        // 模拟减库存操作
        System.out.println("Received order: " + orderId + ", reducing inventory...");
        // 这里可以添加减库存的业务逻辑
    }
}
